package com.topisv.tms.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.AreaGroup;

public interface AreaGroupDao extends PagingAndSortingRepository<AreaGroup, Long>, JpaSpecificationExecutor<AreaGroup> {

	@Query("select areaGroup from AreaGroup areaGroup where areaGroup.groupCode=?")
	AreaGroup findByGroupCode(String groupCode);

	@Query("select t from AreaGroup t where t.customer.customerCode=?")
	List<AreaGroup> loadByCustomerCode(String customerCode);

	@Query("select t from AreaGroup t where t.warehouseType=?")
	List<AreaGroup> loadByWarehouseType(String warehouseType);
	
	@Query("select t from AreaGroup t where t.customer.customerCode=?1 AND t.warehouseType=?2")
	List<AreaGroup> loadByCustomerCodeAndWarehouseType(String customerCode,String warehouseType);
}